<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>

<body>
    <div id="contain">
        <app></app>
    </div>



    <script>
        //定义student组件
        const student = Vue.extend({
            //可以先定义名字
            name: 'Lili',
            data() {
                return {
                    name: 'lili',
                    age: '17',
                    school: 'gyyz'
                }
            },
            template: `
            <div>
            <h2>测试</h2>
            
            </div>
            `
        })
        //定义a组件
        const a = Vue.extend({
            //可以先定义名字
            name: 'Lili',
            data() {
                return {
                    age: '17',
                    school: 'gyyz'
                }
            },
            template: `
            <div>
            <h2>测试</h2>
            <student></student>
            </div>
            `,
            components: {
                student
            }
        })

        const hello = {
            data() {
                return {
                    msg: '你好VUE'
                }
            }
            , template: `<h1>
                {{msg}}</h1>`
        }

        const app = Vue.extend({
            components: {
                'my-school': a,
                hello: hello
            }, template: `<div>
                <my-school></my-school>
                <hello></hello>
        </div>`
        })

        //vm实例
        const vm = new Vue({
            el: '#contain',
            data: {

            },
            components: {
                app
            }
        });




        //推荐用法
        // 1纯小写
        // 2首字母大写 School
        // 3多个单词用-连接
        // 4两个单词首字母大写 需要用脚手架
    </script>

</body>

</html>